Apple, the Apple logo, and Macintosh are registered trademarks of Apple Computer, Inc.
Mac and OpenDoc are trademarks of Apple Computer, Inc.
Parts and EmbeddedFramesIterators
Part editors must be able to create iterators for their embedded frames. When a part receives a CreateEmbeddedFramesIterator call, it should create the iterator and return it.
Creating the iterator
The part editor library will include implementations for subclasses of ODPart and ODEmbeddedFramesIterator, and perhaps other extensions as well. To create the embedded frames iterator the part just allocates and initializes the instance.
The API for ODCreateEmbeddedFramesIterator is somewhat awkward to use, due to a missing parameter in the Init call. The iterator should only operate on the embedded frames of a particular display frame of the part. However, the InitEmbeddedFramesIterator call only takes an ODPart parameter, and not an ODFrame parameter. Therefore, whatever private interface between the iterator and the part that allows the iterator access to the embedded frames, it must be able to handle the mapping to the particular frame.
For instance, after calling InitEmbeddedFramesIterator, the part could make another call to the iterator to let it know which frame it is operating on. Then the iterator would pass the frame back to the part to get the right embedded frames to iterate. Alternately, the part could just remember the mapping of the iterator to the frame, and the iterator could pass itself instead of the frame.
Caveats
• This code does not contain proper error checking
• The OrderedCollection class is a private utility, the implementation is an exercise left for the reader.